package com.scm.servlet.pomain;

import java.io.IOException;
import java.io.PrintWriter;
import java.sql.SQLException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.scm.dao.PomainDao;
import com.scm.util.DbUtil;

/**
 * Servlet implementation class EndPomainServlet
 */
@WebServlet("/main/pomain/EndPomain")
public class EndPomainServlet extends HttpServlet {
	
	private static final long serialVersionUID = 2076406244074149954L;

	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		doPost(req, resp);
	}

	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		String poId = req.getParameter("poId");
		resp.setCharacterEncoding("UTF-8");
		try {
			PomainDao pomaindao = new PomainDao(DbUtil.getConn());
			pomaindao.end(poId);
			PrintWriter pw = resp.getWriter();
			pw.print("了结成功");
			pw.flush();
			pw.close();
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

}
